<?php
require_once("rpcl/rpcl.inc.php");
require_once("config/data.php");
//Includes
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
use_unit("comctrls.inc.php");
use_unit("styles.inc.php");

//Class definition
class student extends Page
{
    public $LabelXueKe = null;
    public $LabelStudentProf = null;
    public $LabelStudentClass = null;
    public $studenttree = null;
    public $PanelSybgBody = null;
    public $LabelSxxm = null;
    public $LabelSxmb = null;
    public $LabelSxsb = null;
    public $LabelSxnr = null;
    public $MemoSxmb = null;
    public $MemoSxsb = null;
    public $MemoSxnr = null;
    public $LabelQuestiion = null;
    public $LabelSxzj = null;
    public $LabelSxcj = null;
    public $MemoSxzj = null;
    public $MemoSxwt = null;
    public $StyleSheetstudent = null;
    public $sxtitle = null;
    public $LabelStudentName = null;
    public $PanelSybgTitle = null;
    public $LabelTeacherName = null;
    public $Image1 = null;
    public $ButtonSubmit = null;
    public $ButtonSave = null;
    public $LabelTjrq = null;
    public $ButtonLoginOut = null;

    //学生界面左侧树形菜单初始化
    function sxcj($sxcjvalue)     //实训评价转化显示
    {
     switch($sxcjvalue)
      {
       case 0:$sxcj='未评阅'; break;
       case 1:$sxcj='优秀';break;
       case 2:$sxcj='良好';break;
       case 3:$sxcj='合格';break;
       case 4:$sxcj='不合格';break;
       case 5:$sxcj='重做';break;
      }
     return $sxcj;
    }
    function StuInitMenu()
    {
     global $dzsxDB;
     $v=$_SESSION['StuId'];
     $MenuId=$_SESSION['MenuId'];
     if(strpos("$MenuId",'-')) //判断是否为实训项目
        {
         $arr=explode('-',$MenuId);
         $CourseId=$arr[0];
         $ExpId=$arr[1];
        }
      else
        {
         $CourseId=$MenuId;
         $ExpId=0;
        }
     //查询第一级菜单项目
     if($dzsxDB->QueryStuCourse->Active)
         $dzsxDB->QueryStuCourse->close();
     $dzsxDB->QueryStuCourse->SQL="Select student.StudentId, student.ClassName, student.StudentName,
  course.CourseName, prof.ProfName, teacher.TeacherName, expinfo.Expfbzt,
  expinfo.CourseId
From course Inner Join
  expinfo On expinfo.CourseId = course.CourseId Inner Join
  prof On expinfo.ProfId = prof.ProfId Inner Join
  student On expinfo.ClassName = student.ClassName Inner Join
  teacher On expinfo.TeacherId = teacher.TeacherId
Group By student.StudentId, student.ClassName, student.StudentName,
  course.CourseName, prof.ProfName, teacher.TeacherName, expinfo.Expfbzt,
  expinfo.CourseId
Having student.StudentId = '$v' And expinfo.Expfbzt = 1";

     $dzsxDB->QueryStuCourse->open();
     $dzsxDB->QueryStuCourse->first();
     while(!$dzsxDB->QueryStuCourse->EOF)
     {
      //添加第一级菜单
      $nodeCourse=$this->studenttree->addNodeToItems('<span style="font-size:13px;font-family:Tahoma;">'.$dzsxDB->QueryStuCourse->CourseName.'</span>', 0, 1, 0 );
      $pid1=$dzsxDB->QueryStuCourse->CourseId;
      $nodeCourse->ItemID=$dzsxDB->QueryStuCourse->CourseId;  //第一级菜单唯一标识为课程的id

      //查询第二级菜单项目
      if($dzsxDB->QueryStuExpInfo->Active)
         $dzsxDB->QueryStuExpInfo->close();
      $dzsxDB->QueryStuExpInfo->SQL="Select expinfo.*  From course Inner Join
        expinfo On expinfo.CourseId = course.CourseId Inner Join
        student On expinfo.ClassName = student.ClassName Inner Join
        teacher On expinfo.TeacherId = teacher.TeacherId Inner Join
        prof On student.ProfId = prof.ProfId
        Where student.StudentId = '$v' And expinfo.CourseId = $pid1 And expinfo.Expfbzt=1 ";
      $dzsxDB->QueryStuExpInfo->open();
      $dzsxDB->QueryStuExpInfo->first();
      while(!$dzsxDB->QueryStuExpInfo->EOF)
        {
         //添加第二级菜单
         $nodeExp=$nodeCourse->addChild('<span style="font-size:13px;font-family:Tahoma;">'.$dzsxDB->QueryStuExpInfo->ExpName.'</span>', 0, 1, 0 );
         $nodeExp->ItemID=$pid1.'-'.$dzsxDB->QueryStuExpInfo->ExpId;  //第二级菜单唯一标识为实训项目的id

         //查询是否已经有该项目的实验报告，若没有，则添加一实训报告
         $pid2=$dzsxDB->QueryStuExpInfo->ExpId;
         $teacheid=$dzsxDB->QueryStuExpInfo->TeacherId;

         if($dzsxDB->QueryStuExpRep->Active)
           $dzsxDB->QueryStuExpRep->close();
         $dzsxDB->QueryStuExpRep->SQL="select * From expreport where ExpId=$pid2 And StudentId='$v'";
         $dzsxDB->QueryStuExpRep->open();

         if($dzsxDB->QueryStuExpRep->RecordCount==0)
           {
            $dzsxDB->QueryInsertExpRep->Active=False;
            $dzsxDB->QueryInsertExpRep->SQL="insert into expreport (ExpId,StudentId,TeacherId,
            sxmb,sxsb,ExpContent,sxwt,sxzj,sxcj,tjrq,Repzt) value ('$pid2','$v','$teacheid','','',
               '','','','','',0)";
            $dzsxDB->QueryInsertExpRep->Active=True;
            $dzsxDB->QueryInsertExpRep->Active=False;
            $dzsxDB->QueryStuExpRep->close();
           }

         /*实训项目信息初始化*/
         //首次进入界面初始化
         if($ExpId==0&&$CourseId==0)
           {
            $nodeCourse->Expanded=true;
            $pid2=$dzsxDB->QueryStuExpInfo->ExpId;
            $teacheid=$dzsxDB->QueryStuExpInfo->TeacherId;
            $this->studenttree->SelectedItemID=$nodeExp->ItemID;
            if($dzsxDB->QueryStuExpRep->Active)
               $dzsxDB->QueryStuExpRep->close();
            $dzsxDB->QueryStuExpRep->SQL="select * From expreport where ExpId=$pid2 And StudentId='$v'";
            $dzsxDB->QueryStuExpRep->open();
            if($dzsxDB->QueryStuExpRep->RecordCount!=0)
              {
               $dzsxDB->QueryStuExpRep->first();
               $this->LabelSxcj->caption="成绩：".$this->sxcj($dzsxDB->QueryStuExpRep->sxcj);
               $this->MemoSxmb->text=$dzsxDB->QueryStuExpRep->sxmb;
               $this->MemoSxsb->text=$dzsxDB->QueryStuExpRep->sxsb;
               $this->MemoSxnr->text=$dzsxDB->QueryStuExpRep->ExpContent;
               $this->MemoSxzj->text=$dzsxDB->QueryStuExpRep->sxzj;
               $this->MemoSxwt->text=$dzsxDB->QueryStuExpRep->sxwt;
               $ExpId=$pid2;
               $CourseId=$pid1;
              }
              $this->LabelXueKe->caption="学科：".$dzsxDB->QueryStuCourse->CourseName;
              $this->LabelSxxm->caption="实训项目：".$dzsxDB->QueryStuExpInfo->ExpName;
              $this->LabelStudentName->caption="姓名：".$dzsxDB->QueryStuCourse->StudentName;
              $this->LabelStudentProf->caption="专业：".$dzsxDB->QueryStuCourse->ProfName;
              $this->LabelStudentClass->caption="班级：".$dzsxDB->QueryStuCourse->ClassName;
              $this->LabelTeacherName->caption="指导教师：".$dzsxDB->QueryStuCourse->TeacherName;

        if($dzsxDB->QueryStuExpRep->Repzt==1)
           {
            $this->ButtonSubmit->Enabled=False;
            $this->ButtonSave->Enabled=false;
            $this->ButtonSave->enabled=False;
            $this->MemoSxmb->enabled=False;
            $this->MemoSxsb->enabled=False;
            $this->MemoSxnr->enabled=False;
            $this->MemoSxzj->enabled=False;
            $this->MemoSxwt->enabled=False;
            $this->LabelTjrq->Caption="提交日期：".$dzsxDB->QueryStuExpRep->tjrq;
           }
         else
           {
            $this->ButtonSubmit->Enabled=True;
            $this->ButtonSave->Enabled=True;
            $this->MemoSxmb->enabled=True;
            $this->MemoSxsb->enabled=True;
            $this->MemoSxnr->enabled=True;
            $this->MemoSxzj->enabled=True;
            $this->MemoSxwt->enabled=True;
            $this->LabelTjrq->caption="当前日期：".date('Y-m-d');
           }


         }

            //选择树菜单中课程选项界面刷新
            else if($ExpId==0&&$CourseId==$nodeCourse->ItemID)
             {
              $nodeCourse->Expanded=true;
              $this->studenttree->SelectedItemID=$nodeExp->ItemID;
              $ExpId=$dzsxDB->QueryStuExpInfo->ExpId;
               if($dzsxDB->QueryStuExpRep->Active)
                $dzsxDB->QueryStuExpRep->close();
              $dzsxDB->QueryStuExpRep->SQL="select * From expreport where ExpId=$ExpId And StudentId='$v'";
              $dzsxDB->QueryStuExpRep->open();
              $dzsxDB->QueryStuExpRep->first();
              $this->LabelXueKe->caption="学科：".$dzsxDB->QueryStuCourse->CourseName;
              $this->LabelSxxm->caption="实训项目：".$dzsxDB->QueryStuExpInfo->ExpName;
              $this->LabelStudentName->caption="姓名：".$dzsxDB->QueryStuCourse->StudentName;
              $this->LabelStudentProf->caption="专业：".$dzsxDB->QueryStuCourse->ProfName;
              $this->LabelStudentClass->caption="班级：".$dzsxDB->QueryStuCourse->ClassName;
              $this->LabelTeacherName->caption="指导教师：".$dzsxDB->QueryStuCourse->TeacherName;
              $this->LabelSxcj->caption="成绩：".$this->sxcj($dzsxDB->QueryStuExpRep->sxcj);
              $this->MemoSxmb->text=$dzsxDB->QueryStuExpRep->sxmb;
              $this->MemoSxsb->text=$dzsxDB->QueryStuExpRep->sxsb;
              $this->MemoSxnr->text=$dzsxDB->QueryStuExpRep->ExpContent;
              $this->MemoSxzj->text=$dzsxDB->QueryStuExpRep->sxzj;
              $this->MemoSxwt->text=$dzsxDB->QueryStuExpRep->sxwt;

           if($dzsxDB->QueryStuExpRep->Repzt==1)
            {
              $this->ButtonSubmit->Enabled=False;
              $this->ButtonSave->Enabled=false;
              $this->ButtonSave->enabled=False;
              $this->MemoSxmb->enabled=False;
              $this->MemoSxsb->enabled=False;
              $this->MemoSxnr->enabled=False;
              $this->MemoSxzj->enabled=False;
              $this->MemoSxwt->enabled=False;
              $this->LabelTjrq->Caption="提交日期：".$dzsxDB->QueryStuExpRep->tjrq;
            }
          else
            {
              $this->ButtonSubmit->Enabled=True;
              $this->ButtonSave->Enabled=True;
              $this->MemoSxmb->enabled=True;
              $this->MemoSxsb->enabled=True;
              $this->MemoSxnr->enabled=True;
              $this->MemoSxzj->enabled=True;
              $this->MemoSxwt->enabled=True;
              $this->LabelTjrq->caption="当前日期：".date('Y-m-d');
            }


         }

            //选择树菜单中项目选项界面刷新
         else if($CourseId==$nodeCourse->ItemID&&$ExpId==$dzsxDB->QueryStuExpInfo->ExpId)
          {
              $nodeCourse->Expanded=true;
              $this->studenttree->SelectedItemID=$nodeExp->ItemID;
              if($dzsxDB->QueryStuExpRep->Active)
                $dzsxDB->QueryStuExpRep->close();
              $dzsxDB->QueryStuExpRep->SQL="select * From expreport where ExpId=$ExpId And StudentId='$v'";
              $dzsxDB->QueryStuExpRep->open();
              if($dzsxDB->QueryStuExpRep->RecordCount!=0)
               {
                $dzsxDB->QueryStuExpRep->first();
                $this->LabelSxcj->caption="成绩：".$this->sxcj($dzsxDB->QueryStuExpRep->sxcj);
                $this->MemoSxmb->text=$dzsxDB->QueryStuExpRep->sxmb;
                $this->MemoSxsb->text=$dzsxDB->QueryStuExpRep->sxsb;
                $this->MemoSxnr->text=$dzsxDB->QueryStuExpRep->ExpContent;
                $this->MemoSxzj->text=$dzsxDB->QueryStuExpRep->sxzj;
                $this->MemoSxwt->text=$dzsxDB->QueryStuExpRep->sxwt;
               }
               $this->LabelXueKe->caption="学科：".$dzsxDB->QueryStuCourse->CourseName;
               $this->LabelSxxm->caption="实训项目：".$dzsxDB->QueryStuExpInfo->ExpName;
               $this->LabelStudentName->caption="姓名：".$dzsxDB->QueryStuCourse->StudentName;
               $this->LabelStudentProf->caption="专业：".$dzsxDB->QueryStuCourse->ProfName;
               $this->LabelStudentClass->caption="班级：".$dzsxDB->QueryStuCourse->ClassName;
               $this->LabelTeacherName->caption="指导教师：".$dzsxDB->QueryStuCourse->TeacherName;

              if($dzsxDB->QueryStuExpRep->Repzt==1)
              {
              $this->ButtonSubmit->Enabled=False;
              $this->ButtonSave->Enabled=false;
              $this->ButtonSave->enabled=False;
              $this->MemoSxmb->enabled=False;
              $this->MemoSxsb->enabled=False;
              $this->MemoSxnr->enabled=False;
              $this->MemoSxzj->enabled=False;
              $this->MemoSxwt->enabled=False;
              $this->LabelTjrq->Caption="提交日期：".$dzsxDB->QueryStuExpRep->tjrq;
              }
             else
              {
              $this->ButtonSubmit->Enabled=True;
              $this->ButtonSave->Enabled=True;
              $this->MemoSxmb->enabled=True;
              $this->MemoSxsb->enabled=True;
              $this->MemoSxnr->enabled=True;
              $this->MemoSxzj->enabled=True;
              $this->MemoSxwt->enabled=True;
              $this->LabelTjrq->caption="当前日期：".date('Y-m-d');
              }
          }
         $dzsxDB->QueryStuExpInfo->next();
        }
      $dzsxDB->QueryStuCourse->next();
     }
    }


    //点击左侧树形菜单右侧显示实验报告
    function studenttreeJSChangeSelected($sender, $params)
    {
        ?>
        //begin js
        document.getElementById("Image1").style.display="block"; //单击树时显示等待效果gif
        var params=studenttree.getSelectedElement().itemid;//获取树itemid
        //lb1=findObj('LabelStudentProf');
        //lb1.innerHTML=studenttree.getSelectedElement().itemid;
         //return false;
        //end
        <?php
     $arr=array('LabelSxxm','LabelTjrq','LabelXueKe','LabelTeacherName','LabelSxcj','MemoSxmb','MemoSxsb',
                'MemoSxnr','MemoSxzj','MemoSxwt','ButtonSubmit','ButtonSave');//,'Image1',MemoGjsb','Memosxnr','MemoSxzj','MemoProblem'
     echo $this->studenttree->ajaxCall("SelectExpReport",array(),$arr);

    }

    //查询学生实验报告显示
    function SelectExpReport($sender,$params)
    {
      global $dzsxDB;
      $_SESSION['MenuId']=$params;
      if(strpos("$params",'-')) //判断是否为实训项目
        {
         $arr=explode('-',$params);
         $cid1=$arr[0];
         $cid2=$arr[1];
         $v=$_SESSION['StuId'];

         //查询当前学科名与实训项目名
         if($dzsxDB->QueryStuExpInfo->Active)
             $dzsxDB->QueryStuExpInfo->close();
         $dzsxDB->QueryStuExpInfo->SQL="Select course.CourseName, expinfo.ExpName
         From expinfo Inner Join course On expinfo.CourseId = course.CourseId
         Where expinfo.ExpId =$cid2 And expinfo.CourseId =$cid1";
         $dzsxDB->QueryStuExpInfo->open();
         $dzsxDB->QueryStuExpInfo->first();

         //查询当前学生的实训报告内容
         if($dzsxDB->QueryStuExpRep->Active)
               $dzsxDB->QueryStuExpRep->close();
         $dzsxDB->QueryStuExpRep->SQL="Select expreport.*, teacher.TeacherName From expreport Inner Join
            teacher On expreport.TeacherId = teacher.TeacherId Where expreport.ExpId = $cid2 And expreport.StudentId = '$v'";
         $dzsxDB->QueryStuExpRep->open();

          $dzsxDB->QueryStuExpRep->first();

            //根据提交的状态显示实训报告各内容的不同状态
           if($dzsxDB->QueryStuExpRep->Repzt==1)
           {
            $this->ButtonSubmit->Enabled=False;
            $this->ButtonSave->Enabled=false;
            $this->MemoSxmb->enabled=False;
            $this->MemoSxsb->enabled=False;
            $this->MemoSxnr->enabled=False;
            $this->MemoSxzj->enabled=False;
            $this->MemoSxwt->enabled=False;
            $this->LabelTjrq->Caption="提交日期：".$dzsxDB->QueryStuExpRep->tjrq;
           }
          else
           {
           $this->ButtonSubmit->Enabled=True;
           $this->ButtonSave->Enabled=True;
           $this->MemoSxmb->enabled=True;
           $this->MemoSxsb->enabled=True;
           $this->MemoSxnr->enabled=True;
           $this->MemoSxzj->enabled=True;
           $this->MemoSxwt->enabled=True;
           $this->LabelTjrq->caption="当前日期：".date('Y-m-d');
           }



         //显示实训报告的内容
         if($dzsxDB->QueryStuExpRep->RecordCount)
           {
            $this->LabelXueKe->caption="学科：".$dzsxDB->QueryStuExpInfo->CourseName;
            $this->LabelSxxm->caption="实训项目：".$dzsxDB->QueryStuExpInfo->ExpName;
            $this->LabelTeacherName->caption="指导教师：".$dzsxDB->QueryStuExpRep->TeacherName;
            $this->LabelSxcj->caption="成绩：".$this->sxcj($dzsxDB->QueryStuExpRep->sxcj);
            $this->MemoSxmb->text=$dzsxDB->QueryStuExpRep->sxmb;
            $this->MemoSxsb->text=$dzsxDB->QueryStuExpRep->sxsb;
            $this->MemoSxnr->text=$dzsxDB->QueryStuExpRep->ExpContent;
            $this->MemoSxzj->text=$dzsxDB->QueryStuExpRep->sxzj;
            $this->MemoSxwt->text=$dzsxDB->QueryStuExpRep->sxwt;
           }
         else
          {
           $this->LabelXueKe->caption="学科：";
           $this->LabelSxxm->caption="实训项目：";
           $this->LabelTeacherName->caption="指导教师：";
           $this->LabelSxcj->caption="成绩：";
           $this->MemoSxmb->text="";
           $this->MemoSxsb->text="";
           $this->MemoSxnr->text="";
           $this->MemoSxzj->text="";
           $this->MemoSxwt->text="";
           $this->ButtonSubmit->Enabled=False;
           $this->ButtonSave->Enabled=False;
           $this->MemoSxmb->enabled=False;
           $this->MemoSxsb->enabled=False;
           $this->MemoSxnr->enabled=False;
           $this->MemoSxzj->enabled=False;
           $this->MemoSxwt->enabled=False;
          }
        }
      else
        {
         $this->LabelXueKe->caption="学科：";
         $this->LabelSxxm->caption="实训项目：";
         $this->LabelTeacherName->caption="指导教师：";
         $this->LabelSxcj->caption="成绩：";
         $this->MemoSxmb->text="";
         $this->MemoSxsb->text="";
         $this->MemoSxnr->text="";
         $this->MemoSxzj->text="";
         $this->MemoSxwt->text="";
         $this->ButtonSubmit->Enabled=False;
         $this->ButtonSave->Enabled=False;
         $this->LabelTjrq->caption="当前日期：".date('Y-m-d');
        }

    }

    //提交实验报告

    function ButtonSubmitJSClick($sender, $params)
    {
        ?>
        //begin js
        document.getElementById("Image1").style.display="block"; //单击树时显示等待效果gif
        var params=studenttree.getSelectedElement().itemid;
        //end
        <?php
     $arr=array('LabelSxxm','LabelTjrq','LabelXueKe','LabelTeacherName','LabelSxcj','MemoSxmb','MemoSxsb',
                'MemoSxnr','MemoSxzj','MemoSxwt','ButtonSubmit','ButtonSave');
     echo $this->ButtonSubmit->ajaxCall("UpdateSybg",array(),$arr);
    }


    function UpdateSybg($sender, $params)
    {
     global $dzsxDB;
     global $flag;
     $flag=0;
     $v=$_SESSION['StuId'];
     $sxmb=$this->MemoSxmb->text;
     $sxsb=$this->MemoSxsb->text;
     $sxnr=$this->MemoSxnr->text;
     $sxzj=$this->MemoSxzj->text;
     $sxwt=$this->MemoSxwt->text;
     $tjrq=date('Y-m-d');
     if(strpos("$params",'-')) //判断是否为实训项目
       {
         $arr=explode('-',$params);
         $cid2=$arr[1];
         if($dzsxDB->QueryUpdateSybg->Active)
           {
            //$dzsxDB->QueryStuExpRep->close(); //关闭对expreport表的其它查询，防止乱码
            $dzsxDB->QueryUpdateSybg->close();
           }
         $dzsxDB->QueryUpdateSybg->SQL="UPDATE expreport SET sxmb='$sxmb',sxsb='$sxsb',ExpContent='$sxnr',
         sxzj='$sxzj',sxwt='$sxwt',Repzt=1,tjrq='$tjrq' Where StudentId='$v' And ExpId=$cid2 ";
         $dzsxDB->QueryUpdateSybg->open();
         $dzsxDB->QueryUpdateSybg->close();
       }
     if(mysql_affected_rows()==1)
       {
        $flag=1;
        $this->ButtonSubmit->enabled=False;
        $this->ButtonSave->enabled=False;
        $this->MemoSxmb->enabled=False;
        $this->MemoSxsb->enabled=False;
        $this->MemoSxnr->enabled=False;
        $this->MemoSxzj->enabled=False;
        $this->MemoSxwt->enabled=False;
        $this->LabelTjrq->Caption="提交日期：".date('Y-m-d');
       }
     else
       {
        $flag=2;
        $this->ButtonSubmit->enabled=True;
        $this->ButtonSave->enabled=True;
        $this->MemoSxmb->enabled=True;
        $this->MemoSxsb->enabled=True;
        $this->MemoSxnr->enabled=True;
        $this->MemoSxzj->enabled=True;
        $this->MemoSxwt->enabled=True;
        $this->LabelTjrq->caption="当前日期：".date('Y-m-d');
       }

    }


   //保存实验报告
   function ButtonSaveJSClick($sender, $params)
    {
        ?>
        //begin js
        document.getElementById("Image1").style.display="block"; //单击树时显示等待效果gif
        var params=studenttree.getSelectedElement().itemid;
        //end
        <?php
     echo $this->ButtonSave->ajaxCall("SaveSybg",array(),array('MemoSxmb','ButtonSave'));
    }

   function SaveSybg($sender, $params)
    {
     global $dzsxDB;
     global $flag;
     $flag=0;
     $v=$_SESSION['StuId'];
     $sxmb=$this->MemoSxmb->text;
     $sxsb=$this->MemoSxsb->text;
     $sxnr=$this->MemoSxnr->text;
     $sxzj=$this->MemoSxzj->text;
     $sxwt=$this->MemoSxwt->text;
     if(strpos("$params",'-')) //判断是否为实训项目
       {
         $arr=explode('-',$params);
         $cid2=$arr[1];
         if($dzsxDB->QueryUpdateSybg->Active)
           {
            //$dzsxDB->QueryStuExpRep->close(); //关闭对expreport表的其它查询，防止乱码
            $dzsxDB->QueryUpdateSybg->close();
           }
         $dzsxDB->QueryUpdateSybg->SQL="UPDATE expreport SET sxmb='$sxmb',sxsb='$sxsb',ExpContent='$sxnr',sxzj='$sxzj',sxwt='$sxwt'
          Where StudentId='$v' And ExpId=$cid2 ";
         $dzsxDB->QueryUpdateSybg->open();
         $dzsxDB->QueryUpdateSybg->close();
       }
     if(mysql_affected_rows()==True)
       {
        $flag=3;
       }
     else
       {
        $flag=4;
       }

    }


 //执行相关操作后的提示
   function studentAfterAjaxProcess($sender, $params)
    {
     global $ajaxResponse;
     global $flag;
     $ajaxResponse->script('document.getElementById("Image1").style.display="none";'); //隐藏等待效果
     switch ($flag)
     {
      case 1: $ajaxResponse->script('alert("提交成功！");');
              break;
      case 2: $ajaxResponse->script('alert("提交内容未改变！");');
              break;
      case 3: $ajaxResponse->script('alert("保存成功！");');
              break;
      case 4: $ajaxResponse->script('alert("保存内容未改变！");');
              break;
    }
  }

   //页面初始化
   function studentCreate($sender, $params)
    {
     global $dzsxDB;
      if(!isset($_SESSION['StuId']))
         redirect("index.php");
      else
        $this->StuInitMenu();

    }
    //浏览器页面标题中文显示

   function studentShow($sender, $params)
    {
      $this->Caption="学生界面";
    }

   function studentShowHeader($sender, $params)
    {
     //加载完等待效果Gif后，将其初始为不可见
     echo '<script type="text/javascript">
      window.onload=function(){ document.getElementById("Image1").style.display="none";}
      </script>' ;
    }


  /*------------------------退出注销用户---------------------*/
   function ButtonLoginOutJSClick($sender, $params)
     {
        ?>
        //begin js
        window.close();
        //end
        <?php
        echo $this->ButtonLoginOut->ajaxCall("ButtonLoginOutClick");
     }
   function ButtonLoginOutClick($sender, $params)
    {
       $_SESSION = array();
       session_destroy();
    }

   /* function studentJSUnload($sender, $params)
    {
        ?>
        //begin js
              var n = window.event.screenX - window.screenLeft;
              var b = n > document.documentElement.scrollWidth-20;
              if(b || window.event.clientY < 0 || window.event.altKey)
                {
                 params=2;
                 //document.getElementById("flagclose").value=2;
                 //document.getElementById("LabelXueKe").innerHTML=document.getElementById("flagclose").value;
                 alert("是关闭而非刷新");
                }
              else
               {
                params=1;
                //document.getElementById("flagclose").value=1;
                //document.getElementById("LabelXueKe").innerHTML=document.getElementById("flagclose").value;
                alert("是刷新");
               }
        //end
        <?php
       echo $this->ajaxCall("ButtonLoginOutClick");
    } */



}


global $application;

global $student;

//Creates the form
$student=new student($application);

//Read from resource file
$student->loadResource(__FILE__);

//Shows the form
$student->show();

?>
